﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assignment_5_Amanda_Boström.ContactFiles
{
    public class Contact
    {
        private string m_firstName = string.Empty;
        private string m_lastName = string.Empty;

        // Aggregation - "has a"
        private Address m_address;

        // Constructors
        /// <summary>
        /// Default Constructor
        /// </summary>
        public Contact() 
        {
            m_firstName = string.Empty;
            m_lastName = string.Empty;
            m_address = null;
        }
        /// <summary>
        /// Constructor taking three parameters.
        /// </summary>
        /// <param name="firstName"></param>
        /// <param name="lastName"></param>
        /// <param name="adr"></param>
        public Contact(string firstName, string lastName, Address adr)
        {
            m_firstName = firstName;
            m_lastName = lastName;
            m_address = adr;
        }

        // Properties

        public Address AddressData
        {
            get { return m_address; }
            set { m_address = value; }
        }

        public string FirstName
        {
            get { return m_firstName; }
            set { m_firstName = value; }
        }

        public string LastName
        {
            get { return m_lastName; }
            set { m_lastName = value; }
        }
        public string FullName
        {
            get { return LastName + ", " + FirstName; }
        }

        // Methods
        /// <summary>
        /// Formats the contact details. Calls the address' overrided ToString.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string strOut = string.Format("{0, -20} {1}", FullName, m_address.ToString());
            return strOut;
        }


        
        

    }
}
